<template>
  <div class="container">
    <div class="header-section">
      <div class="header-wrap">
        <div class="header-box">
          <div class="header-box-title">
            {{ $route.query.title }}
          </div>
        </div>
      </div>
    </div>
    <div class="stats-rows">
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.buyCount }}</div>
        <div class="statictitle">成功报名量</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.payAmountTotal }}</div>
        <div class="statictitle">总支付金额（元）</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.refundCount }}</div>
        <div class="statictitle">退款人数</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.refundAmountTotal }}</div>
        <div class="statictitle">退款金额（元）</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.commissionTotal }}</div>
        <div class="statictitle">微信实收手续费</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.distributionAmountTotal }}</div>
        <div class="statictitle">已发佣金（元）</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.rewardAmountTotal }}</div>
        <div class="statictitle">已发奖励（元）</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.actualAmountTotal }}</div>
        <div class="statictitle">实收金额（元）</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.settlementAmount }}</div>
        <div class="statictitle">已结算金额（元）</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.waitSettlementAmount }}</div>
        <div class="statictitle">待结算实收金额（元）</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.reachCount }}</div>
        <div class="statictitle">开团数</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.fillCount }}</div>
        <div class="statictitle">成团数</div>
      </div>
      <div class="stats-rows-item">
        <div class="static">{{ dataStats.freeShipingTotal }}</div>
        <div class="statictitle">团长免单金额</div>
      </div>
    </div>
    <el-tabs v-model="activeName" @tab-click="handleTabClick">
      <el-tab-pane label="报名信息" name="enroll">
        <EnrollInfoList v-if="activeName === 'enroll'" v-model="this.$route.query.id"/>
      </el-tab-pane>
      <el-tab-pane label="退款信息" name="refund">
        <RefundInfoList v-if="activeName === 'refund'" v-model="this.$route.query.id"/>
      </el-tab-pane>
      <el-tab-pane label="邀请奖励" name="inviteReward">
        <InviteReward v-if="activeName === 'inviteReward'" v-model="this.$route.query.id"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import EnrollInfoList from './components/EnrollInfoList'
import RefundInfoList from './components/RefundInfoList'
import InviteReward from './components/InviteReward'
import { activityDetailStats } from "@/api/triones/activity";
export default {
  name: "ActivityManageDetail",
  components: { EnrollInfoList,RefundInfoList,InviteReward },
  data() {
    return {
      activeName: 'enroll',
      dataStats: {
        browseCount: 0,
        shareCount: 0,
        buyCount: 0,
        payAmountTotal: 0,
        distributionAmountTotal: 0,
        commissionTotal: 0,
        actualAmountTotal: 0,
        settlementAmount: 0,
        waitSettlementAmount: 0,
        rewardAmountTotal: 0,
        reachCount: 0,
        fillCount: 0,
        refundCount: 0,
        refundAmountTotal: 0,
        freeShipingTotal: 0
      }
    }
  },
  created() {
    const activityId = this.$route.query.id;
    this.getActivityDetailStats(activityId);
  },
  methods: {
    /** 切换标签页 */
    handleTabClick(tab, event) {
      if (tab.name === 'enroll') {
      }
      if (tab.name === 'refund') {
      }
      if (tab.name === 'inviteReward') {
      }
    },
    /** 活动统计 */
    getActivityDetailStats(activityId) {
      activityDetailStats(activityId).then(response => {
        this.dataStats = response.data;
      })
    }
  }
}
</script>

<style lang="scss" scoped>

.container {
  position: relative;
  padding: 20px;
  background-color: #fff;
}
.header-section {
  .header-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }
  .header-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    white-space: nowrap;
  }
  .header-box-title {
    font-size: 16px;
    color: #000;
    margin-bottom: 10px;
  }
}

.stats-rows {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  .stats-rows-item {
    width: 16%;
    height: 100px;
    background-color: #fafafa;
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin-bottom: 10px;
    position: relative;
  }
  .static {
    color: #000;
    font-size: 20px;
  }
  .statictitle {
    display: flex;
    align-items: center;
  }
}

</style>
